const http = require('http');

const server = http.createServer((req, res) => {
  if (req.url === '/login') {
    res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
    res.end('<h1>登录页面</h1>');
  } else if (req.url === '/register') {
    res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
    res.end('<h1>注册页面</h1>');
  } else {
    res.writeHead(404, { 'Content-Type': 'text/html; charset=utf-8' });
    res.end('<h1>页面未找到</h1>');
  }
});

server.listen(9000, () => {
  console.log('该响应监听码为:9000');
});